import { createApp } from 'vue';
import App from './App.vue';
import { createPinia } from 'pinia';
import router from './router';
import { directive } from '@/utils/directive';
import { i18n } from '@/i18n/index';
import other from '@/utils/other';
import { addDateRange, parseTime, handleTree, selectDictLabel, download } from '@/utils';
import { getDicts } from '@/api/system/dict/data';
import { dateStrFormat } from '@/utils/formatTime';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import '@/theme/index.scss';
import mitt from 'mitt';
// @ts-ignore

import { install } from '@icon-park/vue-next/es/all';
import '@icon-park/vue-next/styles/index.css';
import './style/index.scss';
import contextmenu from 'vue3-contextmenu';
import 'vue3-contextmenu/dist/vue3-contextmenu.css';
import { registerIcon } from './utils/elIcon';


const app = createApp(App);
// @ts-ignore
window.WApp = app;
const pinia = createPinia();

install(app, 'byte');

directive(app);
other.elSvg(app);
app.use(contextmenu);

app.use(ElementPlus).use(i18n).use(pinia).use(router).mount('#app');
registerIcon(app);

// 全局方法挂载
app.config.globalProperties.getDicts = getDicts;
app.config.globalProperties.mittBus = mitt();
app.config.globalProperties.addDateRange = addDateRange;
app.config.globalProperties.parseTime = parseTime;
app.config.globalProperties.handleTree = handleTree;
app.config.globalProperties.selectDictLabel = selectDictLabel;
app.config.globalProperties.download = download;
app.config.globalProperties.dateStrFormat = dateStrFormat;
